package com.example.product.controller;

import com.example.model.dto.Product;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @Author: ft
 * @Date:2025/8/19
 * @Description: 相关单据：
 */
@RestController()
@RequestMapping("/product")
public class ProductController {

    @GetMapping("/get/{id}")
    public Product get(@PathVariable("id") String id, HttpServletRequest request) throws InterruptedException {
        String token = request.getHeader("token");
        System.out.println("token = " + token);
        Product product = new Product();
        product.setProductId(id);
        product.setProductName("Product-Name1");
        product.setProductPrice(new BigDecimal("100"));
        return product;
    }
}